package com.qd.common.panda.domain.entity.plate;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 车牌管理
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class PlateDTO extends BaseQuery {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "车牌管理";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "车牌"})
    @NotBlank(message = "车牌不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 20, message = "车牌长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String plateNumber;
    /**
     * 车辆类型:0燃油车 1新能源
     */
    @NotNull(message = "车辆类型不能为空", groups = DefaultGroup.class)
    @ExcelIgnore
    private Integer carType;
    /**
     * 车辆显示
     */
    @ExcelProperty(value = {EXCEL_TITLE, "车辆类型"})
    private String carTypeDisplay;
    /**
     * 是否支持etc扣费
     */
    @ExcelIgnore
    private String etcPay;
    /**
     * 是否支持etc扣费显示
     */
    @ExcelIgnore
    private String etcPayDisplay;
    /**
     * 车牌颜色
     */
    @ExcelIgnore
    private Integer vehicleColor;
    /**
     * 车牌颜色显示
     */
    @ExcelProperty(value = {EXCEL_TITLE, "车牌颜色"})
    private String vehicleColorDisplay;
    /**
     * ETC卡号
     */
    @ExcelIgnore
    private String etcCardId;
    /**
     * 添加时间
     */
    private LocalDateTime addTime;

    @Override
    public void freeData() {
        this.plateNumber = null;
        this.carType = null;
        this.carTypeDisplay = null;
        this.etcPay = null;
        this.etcPayDisplay = null;
        this.vehicleColor = null;
        this.vehicleColorDisplay = null;
        this.etcCardId = null;
        this.addTime = null;
        super.freeData();
    }
}
